package action.order;

import java.util.List;
import service.OrderService;
import util.ObjectFactory;
import entity.ReceiveAddress;
import action.BaseAction;

public class OrderAction extends BaseAction{
	//input
	private ReceiveAddress address;
	//output
	private int oid;
	private double cost;
	
	public String execute() throws Exception{
		OrderService service = ObjectFactory.getInstance(OrderService.class);
		List result = service.saveOrder(address, session, httpRes,httpReq);
		cost=Double.parseDouble(result.get(0).toString());
		oid= Integer.parseInt(result.get(1).toString());
		return "success";
	}

	public ReceiveAddress getAddress() {
		return address;
	}

	public void setAddress(ReceiveAddress address) {
		this.address = address;
	}


	public int getOid() {
		return oid;
	}

	public void setOid(int oid) {
		this.oid = oid;
	}

	public double getCost() {
		return cost;
	}

	public void setCost(double cost) {
		this.cost = cost;
	}
	
}
